"""
dict1 = {'name':'allen'}
dict2 = {'age':'18'}
dict1.update(dict2)
print(dict1)
"""
"""
list1 = [1,2,3]
list2 = [4,5,6]
list1.extend(list2)
print(list1)

"""
"""
set1 = {2,3,4,5,7}
set2=int(input("请输入一个数字"))
if 12 in set1:
    print("12在集合中")
else:
    print("12不在集合中")
    """
""" 
if 3 in set1:
    print("3在集合中")
else:
    print("3不在集合中")
"""
#
# str1 = int(input("请输入一个账号密码"))
# str2 = str1.strip()
# if str2 == "admin123456":
#     print("登录成功")
# else:
#     print("登录失败")
"""
user = input("请输入您的账号").strip()
pwd = input("请输入您的密码").strip()

if user == 'admin' and pwd =='123456':
    print("登录成功")
else:
    print("账号密码错误，登录失败！")
"""

# for i in range(3):
#    user = input("请输入用户名")
#    pwd = input("请输入密码")
#    if (user == 'seven' or user == 'alex') and pwd == '123':
#      print("登陆成功")
#      break
#    else:
#      print("登陆失败,请重新输入账号和密码")


# numbers = 0
# for i in range(1,101):
#     if i %3 == 0:
#         numbers +=1
# print(f"程序计算100以内有{numbers}个3的整数倍数字")


"""
dict1={'name':'韩梅梅','age':'33'}
dict1['name'] = '韩涛'
dict1['sex'] = '男'
dict1.pop('age')
print(dict1)
"""

# for i in range(3):
#     a = input("用户请输入")
#     if 'c' in a:
#         print("包含c")
#         break
#     else:
#         print("不包含c")


# result = {}
# while True:
#     name = input("请输入姓名")
#     if name == 'q':
#         print("停止收集")
#         break
#     age = input("请输入年龄")
#     if age == 'q':
#         print("停止收集")
#         break
#     address = input("请输入地址")
#     if address == 'q':
#         print("停止收集")
#         break
#     phone = input("请输入电话")
#     if phone == 'q':
#         print("停止收集")
#         break
#     result[name] = {"电话":phone,"年龄":age,"地址":address}
# print("展示全部的个人信息：\n")
# print(result)
# name = input("请输入你要查询到姓名:")
# if name in result:
#     print(f"您当前查询的姓名为：{name}，电话是：{result[name]['电话']}，地址是：{result[name]['地址']}，年龄是：{result[name]['年龄']}")

# 9、图书管理系统
# 支持选项,选择功能
# 图书管理系统：
# 1.添加图书
# 2.删除图书
# 3.修改图书
# 4.查询图书
# 5.显示所有图书
# 6.退出操作
book_dict = {}
while true:
    print("欢迎来到图书管理系统")
    print("功能选择：")
    print("①添加图书")
    print("②删除图书")
    print("③修改图书")
    print("④查询图书")
    print("⑤显示所有图书")
    print("⑥退出操作")
    r = input("请输入你要选择的序号：")
    if r == '1':
        book_name = input("请输入图书名称")
        book_zuoze = input("请输入图书作者")
        book_creatTime = inout("请输入图书创建时间")
        if book_name not in book_dict:
            book_dict[book_name] = {"图书作者":book_zuoze,"图书创建时间":book_creatTime}
            print("添加图书成功，图书名为:%s"%book_name)
        else:
            print("%s图书已存在，添加失败"%book_name)
        pass
    if r == '2':
        book_name = input("请输入要删除的图书名称")
        if book_name in book_zuoze:
            book_dict.pop(book_name)
            print(f"图书:{book_name}删除成功")
        else:
            print("%s图书不存在，删除失败"%book_name)
    if r == '3':
        old_book_name = input("请输入您要修改的图书名称：")
        if old_book_name in book_name:
            new_book_name = input("请输入您要的新的图书名称")
            book_zuoze = input("请输入作者：")
            book_creatTime = input("请输入图书创建时间：")
            book_dict.pop(old_book_name)
            book_dict[new_book_name] = {"图书作者":book_zuoze,"图书创建时间":book_creatTime}
            print

















# import random
#
# target = random.randint(0, 9)
#
# while True:
#     try:
#         guess = int(input("请输入 0~9 之间的整数："))
#         if guess < 0 or guess > 9:
#             print("输入超出范围，请重新输入！")
#             continue
#     except ValueError:
#         print("请输入整数！")
#         continue
#
#     if guess > target:
#         print("太大")
#     elif guess < target:
#         print("太小")
#     else:
#         print("恭喜！你猜中了！")
#         break

# # 读取 4 个整数
# list1 = list(map(int, input("请输入 4 个整数（空格分隔）：").split()))
# # 读取 3 个整数
# list2 = list(map(int, input("请输入 3 个整数（空格分隔）：").split()))
#
# list1.extend(list2)   # 合并
# list1.extend([90, 100])  # 追加
# list1.sort(reverse=True)   # 降序
#
# print("最终 list1 =", list1)

# 极简一行
# def length_of_last_word(s: str) -> int:
#     return len(s.strip().split()[-1]) if s.strip() else 0
#
# # 常规写法（不依赖 split）
# def length_of_last_word(s: str) -> int:
#     i, n = len(s) - 1, 0
#     # 跳过尾部空格
#     while i >= 0 and s[i] == ' ':
#         i -= 1
#     # 统计最后一个单词长度
#     while i >= 0 and s[i] != ' ':
#         n += 1
#         i -= 1
#     return n
#
#
# # 测试
# if __name__ == "__main__":
#     tests = ["Hello World", "   fly me   to   the moon  ", "a ", "   "]
#     for t in tests:
#         print(f"{t!r} -> {length_of_last_word(t)}")

# a = float(input("请输入第1个数："))
# b = float(input("请输入第2个数："))
# c = float(input("请输入第3个数："))
#
# # 仅用 if 语句
# min_val = a
# if b < min_val:
#     min_val = b
# if c < min_val:
#     min_val = c
#
# print("最小值为：", min_val)

# s = input("请输入一个字符串：")
# print("反转后：", s[::-1])

# n = int(input("请输入一个整数："))
# result = "偶数" if n % 2 == 0 else "奇数"
# print(f"{n} 是{result}")

# total = sum(n for n in range(1, 101) if n % 7 == 0 and n % 5 != 0)
# print("和为：", total)




# listinfo = [133, 88, 24, 33, 232, 44, 11, 44]
#
# result = [x for x in listinfo if x < 100 and x % 2 == 0]
# print(result)          # → [88, 24, 44, 44]


# num = input("请输入任意整数：")
# # 去掉可能的正负号后统计长度
# print("位数：", len(num.lstrip('+-')))


# from typing import List
#
# def two_sum(nums: List[int], target: int) -> List[int]:
#     index_map = {}                      # 数值 → 下标
#     for i, num in enumerate(nums):
#         need = target - num
#         if need in index_map:           # 找到配对
#             return [index_map[need], i]
#         index_map[num] = i
#     return []                           # 题目保证不会走到这里
#
# # 简易测试
# if __name__ == "__main__":
#     nums = [2, 7, 11, 15]
#     target = 9
#     print(two_sum(nums, target))        # → [0, 1]



































